package com.gopay.common.cps.dao.gp.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.gp.CpsGpContractLogDAO;
import com.gopay.common.domain.cps.gp.CpsGpContractLog;
/**
 * P2P签约协议信息日志
 * @CpsGpContractInfoDAOImpl.java
 * @author lizheng
 * @2014-4-18 下午3:20:12  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("cpsGpContractLogDAO")
public class CpsGpContractLogDAOImpl  extends BaseDAOImpl<CpsGpContractLog, Serializable> implements CpsGpContractLogDAO {
    
    @Override
    public CpsGpContractLog getContractLog(String contractId, String inTxnCD) {
        DetachedCriteria criteria = DetachedCriteria.forClass(CpsGpContractLog.class);
        criteria.add(Restrictions.eq("contractId", contractId));
        criteria.add(Restrictions.eq("lastUpdTrancode", inTxnCD));
        List<CpsGpContractLog> list = this.findByCriteria(criteria);
        if (list.size() > 0) {
            return list.get(0);
        } else {
            return null;
        }
    }
}
